package Work0508;

import java.util.Scanner;

public class VipOperateTest {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		VipOperate test = new VipOperate();
		while (true) {
			System.out.println("1.增加会员2.展示会员3.查询积分4.增加积分9.退出");
			System.out.println("请选择：");
			int number = in.nextInt();
			if (number == 1) {
				Vip s = new Vip();
				System.out.print("请输入会员编号：");
				s.name = in.next();
				System.out.print("请输入会员积分：");
				s.number = in.nextInt();
				boolean q = test.addNewVip(s);
				System.out.println(q ? "添加成功" : "编号重复,添加失败");

			} else if (number == 2) {
				test.showVip();

			} else if (number == 3) {
				System.out.print("请输入要查找的会员编号：");
				String findName = in.next();
				Vip v = test.findNumber(findName);
				if (v == null) {
					System.out.println("查无此会员。");
				} else {
					System.out.println("该会员的积分为：" + v.number);
				}

			} else if (number == 4) {
				System.out.print("请输入要增加积分的会员名称：");
				String addName = in.next();
				System.out.print("请输入要增长的积分为：");
				int addNumber = in.nextInt();
				boolean w = test.addNumber(addName, addNumber);
				System.out.println(w ? "增长成功" : "未找到该会员");

			} else if (number == 9) {
				break;
			}
		}
	}

}
